home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d6 / glazer.arc / BALREM.BAS < prev    next >
BASIC Source File  |  1988-10-07  |  1KB  |  28 lines

  1. 100 'Balance Remaining and Interest Paid ("BALREM")
  2. 110 CLS
  3. 120 COLOR 0,15 : PRINT "Balance Remaining" : COLOR 15,0
  4. 130 PRINT
  5. 140 MONEYFMT$ = "$$##,###,###.##"
  6. 150 DEFDBL A-Z
  7. 160 DEFINT M-N
  8. 170 '     Define function to find balance
  9. 180 DEF FNBALANCE (N) = ( ( (1+PR) ^ -N -1) * PMT / PR + PNCPL) * (1 + PR) ^ N
  10. 190 '     Let user enter data
  11. 200 INPUT "Amount of loan: ", PNCPL
  12. 210 INPUT "Monthly payment: ", PMT
  13. 220 INPUT "Annual interest rate (in percent): ", AR
  14. 230 INPUT "Payment number at start of term: ", NSTART
  15. 240 INPUT "Payment number at end of term: ", NEND
  16. 250 '     Find balance due at both times
  17. 260 PR = AR / 1200
  18. 270 IF PR <> 0  THEN SBALANCE = FNBALANCE (NSTART)                                              ELSE SBALANCE = PNCPL - NSTART * PMT
  19. 280 IF PR <> 0  THEN EBALANCE = FNBALANCE (NEND)                                                ELSE EBALANCE = PNCPL - NEND * PMT
  20. 290 '     Find interest paid
  21. 300 TOTALINTEREST = (NEND - NSTART) * PMT + EBALANCE - SBALANCE
  22. 310 '     Print results
  23. 320 PRINT:PRINT
  24. 330 PRINT "Initial balance:" TAB(20); USING MONEYFMT$; SBALANCE
  25. 340 PRINT "Final balance:" TAB(20); USING MONEYFMT$; EBALANCE
  26. 350 PRINT "Interest paid:" TAB(20); USING MONEYFMT$; TOTALINTEREST
  27. 360 END
  28.